package com.jn.mvvm.views;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.jn.mvvm.R;
import com.jn.mvvm.databinding.ActivitySecondBinding;
import com.jn.mvvm.entity.Book;
import com.jn.mvvm.utils.LogUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SecondActivity extends AppCompatActivity {
    private ActivitySecondBinding binding;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_second);

        Intent intent = getIntent();
        if (intent.hasExtra("book")) {
            Book book = (Book) intent.getSerializableExtra("book");
            LogUtils.d("asdf", "==========" + book.toString());
        }

        List<String> list = new ArrayList();
        list.add("A");
        list.add("B");
        list.add("C");
        Map<String, String> map = new HashMap<>();
        map.put("aa", "111");
        map.put("bb", "222");
        map.put("cc", "333");

        binding.setMap(map);
        binding.setKey("bb");
        binding.setList(list);
        binding.setIndex(2);
    }
}